<?php

Route::get('/', 'AdminController@index')->name('admin.index'); //后台首页
Route::get('sex_total', 'AdminController@sex_total')->name('admin.sex_total'); //性别统计
Route::delete('destroy', 'AdminController@destroy')->name('admin.destroy'); //清楚缓存

//商城管理
Route::prefix('shop')->namespace('Shop')->group(function () {
   //商品列表
   Route::prefix('products')->group(function () {
      Route::patch('change_attr', 'ProductController@change_attr')->name('products.change_attr'); //改变属性
      Route::patch('change', 'ProductController@change')->name('products.change'); //排序，改变库存
      Route::post('delete_all', 'ProductController@delete_all')->name('products.delete_all'); //多选删除
      Route::post('delete_img', 'ProductController@delete_img')->name('products.delete_img'); //删除相册
   });
   Route::resource('products', 'ProductController')->except('create', 'edit');
   //商品分类
   Route::prefix('categories')->group(function () {
      Route::patch('change_attr', 'CategoryController@change_attr')->name('categories.change_attr'); //改变属性
      Route::patch('change_sort', 'CategoryController@change_sort')->name('categories.change_sort'); //排序
   });
   Route::resource('categories', 'CategoryController')->except('create', 'edit');
   //订单管理
   Route::prefix('orders')->group(function () {
      Route::get('order_address/{id}', 'OrderController@order_address')->name('orders.order_address');  //收货地址
      Route::patch('edit_address/{id}', 'OrderController@edit_address')->name('orders.edit_address');  //更新收货地址
   });
   Route::resource('orders', 'OrderController')->except('create');
   //会员管理
   Route::resource('users', 'UserController')->except('create', 'edit');
   //账户管理
   Route::resource('accounts', 'AccountController')->except('create', 'store');
   //优惠券
   Route::prefix('tickets')->group(function () {
      Route::patch('change_sort', 'TicketController@change_sort')->name('tickets.change_sort');  //排序
   });
   Route::resource('tickets', 'TicketController')->except('edit');
   //物流管理
   Route::prefix('expresses')->group(function () {
      Route::patch('change_attr', 'ExpressController@change_attr')->name('expresses.change_attr'); //改变属性
      Route::patch('change_sort', 'ExpressController@change_sort')->name('expresses.change_sort'); //排序
   });
   Route::resource('expresses', 'ExpressController')->except('create', 'edit');
});

//广告管理
Route::prefix('ad')->namespace('Ad')->group(function () {
   //广告管理
   Route::prefix('adverts')->group(function () {
      Route::patch('change_attr', 'AdvertController@change_attr')->name('adverts.change_attr'); //改变属性
      Route::patch('change_sort', 'AdvertController@change_sort')->name('adverts.change_sort'); //排序
      Route::post('delete_all', 'AdvertController@delete_all')->name('adverts.delete_all'); //多选删除
   });
   Route::resource('adverts', 'AdvertController')->except('edit', 'create');
   //广告分类
   Route::prefix('advert_nodes')->group(function () {
      Route::patch('change_attr', 'AdvertNodeController@change_attr')->name('advert_nodes.change_attr'); //改变属性
      Route::patch('change_sort', 'AdvertNodeController@change_sort')->name('advert_nodes.change_sort'); //排序
   });
   Route::resource('advert_nodes', 'AdvertNodeController')->except('edit', 'create');
});

//系统管理
Route::prefix('system')->namespace('System')->group(function () {
   //系统设置
   Route::resource('configs', 'ConfigController')->only('index', 'update');
});


